home *** CD-ROM | disk | FTP | other *** search
/ Complete Internet Archive / Complete Internet Archive.iso / Web Boards / WebForum_tar(2).Z / WebForum_tar(2) / WebForum / src / cancel.pl < prev    next >
Encoding:
Text File  |  1995-01-19  |  1.0 KB  |  41 lines

  1. #
  2. # cancel a message (only the poster can cancel a message)
  3. #
  4. # Copyright (C) 1994 Afzal Ballim
  5.  
  6. ############################################################
  7. #
  8. # WFCommandCancel:
  9. #
  10. sub WFCommandCancel {
  11. local (%in)=@_;
  12.  
  13. $user=$ENV{"REMOTE_USER"};
  14. %userdb=&WFReadDBFile($user);
  15.  
  16. if ($in{"forum"} eq "") {return "No forum given";}
  17. if ($in{"subject"} eq "") {return "No subject given";}
  18. if ($in{"message"} eq "") {return "No message selected";}
  19.  
  20. %mb=&WFGetFile("ABSWFSPOOL/$in{forum}/$in{subject}/$in{message}");
  21.  
  22. # have tobe the creator or a webmaster to cancel
  23. if ($mb{"poster"} ne "$user ($userdb{username})" &&
  24.     !&WFUserInGroup($user,"webmasters")) {
  25.  return "Permission denied: You are not the poster of this message.";
  26. }
  27.  
  28. if (unlink("ABSWFSPOOL/$in{forum}/$in{subject}/$in{message}") != 1) {
  29.     return "Unable to cancel the message";
  30. }
  31.  
  32. # if there are no more messages on the subject, cancel
  33. # the subject as well.
  34. rmdir("ABSWFSPOOL/$in{forum}/$in{subject}");
  35.  
  36. print "<hr><h3>Message cancelled.</h3><hr>";
  37. return "";
  38. }
  39.  
  40. 1;
  41.